export const ioniconContent = new Map();
const requests = new Map();

export const getSvgContent = (url) => {
    let req = requests.get(url);

    if (!req) {
    // we don't already have a request
        req = fetch(url).then(rsp => {
            if (rsp.ok) {
                return rsp.text().then(svgContent => {
                    ioniconContent.set(url, svgContent);
                });
            }
            ioniconContent.set(url, '');
        });
        requests.set(url, req);
    }

    return req;
};
